package oppAdemo1p;

public class Test {
    public static void main(String[] args) {
        Role r1 = new Role("乔峰",100,'男');
        Role r2 = new Role("灭绝师太",100,'女');

        r1.showRoleInfo();
        System.out.println();
        r2.showRoleInfo();

        //战斗开始
        while(true){
            //r1攻击r2
            r1.attack(r2);

            //判断r2的剩余血量
            if(r2.getBlood() <= 0){
                System.out.println(r1.getName() + "杀死了" + r2.getName());
                break;
            }

            //r2攻击r1
            r2.attack(r1);

            //判断r1的剩余血量
            if(r1.getBlood() <= 0){
                System.out.println(r2.getName() + "杀死了" + r1.getName());
                break;
            }

        }
    }
}
